import React, { useState, useEffect } from 'react'
import { View, Button } from '@tarojs/components'
import router from '@/utils/router'
import { get, post } from '@/utils/restful'

const Home = () => {
  const [count, setCount] = useState(0)
  useEffect(() => {

  }, [])

  const toCustom = () => {
    router.push({
      path: '/pages/home/index',
      query: {
        id: 5
      }
    })
  }

  const getData = async() => {
    const res = await get('/getGetData')
    console.log(res)
  }
  const postData = async() => {
    const res = await post('/getPostData')
    console.log(res)
  }

  return (
    <View>
      <Button type="primary" onClick={ getData }>GET</Button>
      <Button type="primary" onClick={ postData }>POST</Button>
    </View>
  )
}

export default Home